package com.guigu.work.feign;

import com.guigu.base.entity.CoreOrg;
import com.guigu.base.entity.GlobalUser;
import com.guigu.base.entity.dto.*;
import com.guigu.base.entity.vo.TransportLineVO;
import com.guigu.tms.result.R;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @ClassName:BaseFeign
 * @Description://TODO
 * @Author:taoLong
 * @Date:2021/11/27:15:18 星期六
 * @email:2391611102@qq.com or 2391611102qq@gmail.com
 */
@FeignClient(value = "service-base")
public interface BaseFeign {

    /**
     * 根据id获取车次详情
     *
     * @param id 车次id
     * @return 车次信息
     */
    @GetMapping("/goods/pd-transport-trips/{id}")
    @ApiOperation("根据id获取车次详情")
    public R<TransportTripsDto> fineTripsById(@PathVariable(name = "id") String id);

    /**
     * 根据id查找组织机构信息
     *
     * @param id
     * @return
     */
    @ApiOperation("根据id查找组织机构信息")
    @GetMapping("/base/core-org/{id}")
    public R<CoreOrg> findCoreOrgById(@PathVariable("id") String id);

    /**
     * 根据id获取车辆详情
     *
     * @param id 车辆id
     * @return 车辆信息
     */
    @GetMapping("/goods/pd-truck/{id}")
    @ApiOperation("根据id获取车辆详情")
    public R<TruckDto> findTruckById(@PathVariable(name = "id") String id);

    /**
     * 根据快递员Id查询其员工信息
     *
     * @param courierId
     * @return
     */
    @ApiOperation("根据快递员Id查询其员工信息")
    @GetMapping("/base/global-user/queryAccordingToTheCourierId/{courierId}")
    public GlobalUser queryAccordingToTheCourierId(@PathVariable("courierId") String courierId);


    /**
     * 根据机构Id查询它对应的快递员信息
     *
     * @param coreOrgId 机构Id
     * @return
     */
    @ApiOperation("根据机构Id查询它对应的快递员信息")
    @GetMapping("/base/pd-courier-scop/findGlobalUserByCoreOrgId/{coreOrgId}")
    public R<List<GlobalUser>> findGlobalUserByCoreOrgId(@PathVariable("coreOrgId") String coreOrgId);

    /**
     * 查询全部用户
     *
     * @return
     */
    @GetMapping("/base/global-user/")
    @ApiOperation("查询全部用户")
    public R<List<GlobalUser>> queryAll();

    /**
     * 获取司机基本信息
     *
     * @param id 司机id
     * @return 司机基本信息
     */
    @GetMapping("/goods/pd-truck-driver/{id}")
    @ApiOperation("获取司机基本信息")
    public R<TruckDriverDto> findOneDriver(@PathVariable(name = "id") String id);


    /**
     * 根据id获取线路详情
     *
     * @param id 线路id
     * @return 线路详情
     */
    @GetMapping("/goods/pd-transport-line/{id}")
    @ApiOperation("根据id获取线路详情")
    public R<TransportLineDto> fineById(@PathVariable(name = "id") String id);


    /**
     * 获取车队列表
     *
     * @param ids 车队Id列表
     * @return 车队列表
     */
    @GetMapping("/goods/pd-fleet/")
    @ApiOperation("获取车队列表")
    public R<List<FleetDto>> findAll(@RequestParam(value = "ids", required = false) List<String> ids, @RequestParam(value = "agencyId", required = false) String agencyId);


    @ApiOperation("查询该线路下的车次车辆司机信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "线路id"),
            @ApiImplicitParam(name = "truckId", value = "车辆Id"),
            @ApiImplicitParam(name = "driverId", value = "司机Id"),
            @ApiImplicitParam(name = "tripsId", value = "车次Id")
    })
    @GetMapping("/goods/pd-transport-line/findTransportLineVOById")
    public R<TransportLineVO> findTransportLineVOById(@RequestParam(required = false,value = "id") String id,
                                                      @RequestParam(required = false,value = "truckId") String truckId,
                                                      @RequestParam(required = false,value = "driverId") String driverId,
                                                      @RequestParam(required = false,value = "tripsId") String tripsId);

    /**
     * 根据id查询全局用户信息
     * @param id
     * @return
     */
    @ApiOperation("根据id查询全局用户信息")
    @GetMapping("/base/global-user/findGlobalUserById/{id}")
    public R<GlobalUser> findGlobalUserById(@PathVariable("id") String id);



    /**
     * 司机提货网点信息
     *
     * @param startAgencyId
     * @param endAgencyId
     * @return
     */
    @GetMapping("/base/global-user/driverInfo/{startAgencyId}/{endAgencyId}")
    @ApiOperation("司机提货信息")
    public R<Map> driverInfo(@PathVariable("startAgencyId") String startAgencyId,
                             @PathVariable("endAgencyId") String endAgencyId);
}
